/**
 * @file categories/math/number_theory/congruence/luogu1154/main.cpp
 * @brief
 * @see
 * @author Ruiming Guo (guoruiming@stu.scu.edu.cn)
 * @copyright 2022
 * @date 2022/7/8 14:13:39
 **/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const int N = 5010;
int a[N];
int n;
const int S = 1000000 + 10;
bool vis[S];
int main() {
  // High rating and good luck!
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n - 1; ++i)
    for (int j = i + 1; j < n; ++j) vis[abs(a[i] - a[j])] = true;

  for (int k = 1; k < S; ++k) {
    bool ok = true;
    for (int j = k; j < S; j += k) {
      if (vis[j]) {
        ok = false;
        break;
      }
    }
    if (ok) {
      cout << k << endl;
      break;
    }
  }
  return 0;
}
